package com.morty.config.model;

import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TableModifyLog implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 日志ID
     */
    private String logId;

    /**
     * 微服务名称
     */
    private String module;

    /**
     * 类名
     */
    private String className;

    /**
     * 方法名
     */
    private String methodName;

    /**
     * 操作描述
     */
    private String operationDesc;

    /**
     * 登录用户
     */
    private String operator;

    /**
     * 操作时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operationTime;

    /**
     * 服务总时长(毫秒)
     */
    private Long costMilliTime;

    /**
     * 根路径
     */
    private String rootPath;

    /**
     * uri
     */
    private String uri;

    /**
     * 请求方式
     */
    private String entryMethod;

    /**
     * 请求参数
     */
    private String params;

    /**
     * 用户设备
     */
    private String userDevice;

    /**
     * 用户IP
     */
    private String userIp;

    /**
     * 方法的返回结果
     */
    private Integer requestResult;

    @Override
    public String toString() {
        return "TableModifyLog{" +
                "logId='" + logId + '\'' +
                ", module='" + module + '\'' +
                ", className='" + className + '\'' +
                ", methodName='" + methodName + '\'' +
                ", operationDesc='" + operationDesc + '\'' +
                ", operator='" + operator + '\'' +
                ", operationTime=" + operationTime +
                ", costMilliTime=" + costMilliTime +
                ", rootPath='" + rootPath + '\'' +
                ", uri='" + uri + '\'' +
                ", entryMethod='" + entryMethod + '\'' +
                ", params='" + params + '\'' +
                ", userDevice='" + userDevice + '\'' +
                ", userIp='" + userIp + '\'' +
                ", requestResult=" + requestResult +
                '}';
    }
}
